
import React from 'react'
import { BrowserRouter as Router, Route, Routes, Navigate, useRoutes } from 'react-router-dom'
import AuthRoute from 'components/AuthRoute'
import Login from './pages/Login'
import Layout from './pages/Layout'
import Home from 'pages/Home'
import ArticleList from 'pages/ArticleList'
import ArticlePublish from 'pages/ArticlePublish'
import history from 'utils/history'



export default function App() {

  return (

    <Router history={history}>
      <div>
        <Routes>
          <Route path="/" element={<Navigate to='login' />} />
          <Route path='/login' element={<Login />}></Route>
          {/* <AuthRoute path='/login' element={<div>登录</div>}></AuthRoute> */}
          <Route path='/home' element={<Layout />}>


            <Route path='/home' index element={<Home />}></Route>
            <Route path='/home/list' element={<ArticleList />}></Route>
            <Route path='/home/publish' element={<ArticlePublish />} exact key='add'></Route>
            <Route
              path="/home/publish/:id"
              element={<ArticlePublish />}
              key='edit'
            />

          </Route>
        </Routes>
      </div>
    </Router>
  )
}
// export default App;
